package com.adv.ems.model.vo;

import com.adv.ems.constants.EmsConst;
import com.adv.ems.db.entity.EnergyInfoDO;
import com.adv.ems.utils.EmsUtil;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class IndexEnergyInfoVO {
    private List<Info> list;
    private String standUnite;
    private String cashUnite;

    public IndexEnergyInfoVO() {
        this.list = new ArrayList<Info>();
        this.standUnite = EmsConst.UNIT_STAND;
        this.cashUnite = EmsConst.UNIT_CASH;
    }

    @Data
    public static class Info {
        private Long id;
        private String name;
        private String code;
        private String unite;

        public Info(EnergyInfoDO energyInfo, String acceptLanguage) {
            this.id = energyInfo.getId();
            this.name = EmsUtil.multilingual(energyInfo.getNameInfo(), acceptLanguage);
            this.code = energyInfo.getCode();
            this.unite = energyInfo.getCumulateUnit();
        }
    }
}
